package com.acme.bankapp.service.bank;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import com.acme.bankapp.domain.bank.Bank;
import com.acme.bankapp.domain.bank.CheckingAccount;
import com.acme.bankapp.domain.bank.Client;
import com.acme.bankapp.domain.bank.Gender;
import com.acme.bankapp.domain.bank.SavingAccount;
import com.acme.bankapp.domain.exceptions.ClientExistsException;
import com.acme.bankapp.domain.exceptions.NotEnoughFundsException;
import com.acme.bankapp.domain.exceptions.OverDraftLimitExceededException;
import com.acme.bankapp.service.bank.BankDataLoaderService;
import com.acme.bankapp.service.bank.BankReport;

public class BankApplication {	
	
	
	public static void main(String[] args) {
		
		if(args.length < 2) {
			System.out.println("the wrong input data");
			return;
		}
		if (!args[0].equals("-loadfeed")) {
			System.out.println("not a -loadfeed");
			return;
		}
				
		Bank SberBank = new Bank();	
		BankReport br = new BankReport();
		try {
			BankDataLoaderService bs = new BankDataLoaderService(args[1], "");			
			bs.bankLoad(SberBank);
			System.out.println("*********Bank Report****************");
			System.out.println("num of accounts = " + br.getNbOfAccounts(SberBank));
			br.getAccountsSortedBySum(SberBank);
			System.out.println("*******************Map***********");
			System.out.println(br.getCustomerAccount(SberBank));
		}
		catch (FileNotFoundException e) {
			System.out.println("feedfile does not exists");
			return;
		} catch (IOException e) {
			System.out.println("IOexception");
		}		
	}

}
